<?php

  require_once('db.php');
  if(isset($_POST['email'], $_POST['password']) && !empty($_POST['email'])&& !empty($_POST['password'])){
    pr($_POST);
    $email = trim($_POST['email']);
    $password = md5(trim($_POST['password']));
    pr($password);
    $date = date('Y-m-d H:i:s');
    $query = "INSERT INTO `users`
              SET email='$email', `password`='$password',`register_date`='$date',`status`='1'";

    mysql_query($query) or die(mysql_error());
    $last_insert_id = mysql_insert_id();
    echo "User INserted on ID $last_insert_id\n\n";
  }else {
    echo "<h4>Error</h4>";
  }
?>

<form action="" method="post">
<table border="1">
  <thead>
    <tr>
      <th colspan="2">Register Here</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Email : </td>
      <td><input type="email"   name="email" value="<?=@$_POST['email']?>" /></td>
    </tr>
    <tr>
      <td>Password : </td>
      <td><input type="password"  name="password" value="" /></td>
    </tr>
    <tr>
      <td></td>
      <td><input type="submit"   value="Register ME" /></td>
    </tr>
  </tbody>
</table>

</form>
